import BaseMusicPrefab from "../../base/Script/components/BaseMusicPrefab";
import LogUtil from "../../base/Script/utils/LogUtil";

const { ccclass, property } = cc._decorator;

@ccclass
export default class playMusic extends cc.Component {

    // LIFE-CYCLE CALLBACKS:
    @property(cc.String)
    musicPath: string = "";

    onLoad() {
        LogUtil.log("musicPath==",this.musicPath);
        this.playMusic();
    }
    
    async playMusic(){
        if(BaseMusicPrefab.instance == null){
            await BaseMusicPrefab.preLoad();
        }
        BaseMusicPrefab.playByBundle(this.musicPath,"FruitNinja");
    }

    onDestroy() {
        
    }
}
